As used herein, a network element (e.g., a router, switch, bridge) is a piece of networking equipment, including hardware and software, that communicatively interconnects other equipment on the network (e.g., other network elements, end stations). Some network elements are “multiple services network elements” that provide support for multiple networking functions (e.g., routing, bridging, switching, Layer 2 aggregation, session border control, Quality of Service, and/or subscriber management), and/or provide support for multiple application services (e.g., data, voice, and video). In typical network elements such as routers or switches, a network processor performs the packet switching and routing functions between a physical layer portion of a network and a switch fabric of the network element. Some of these functions include packet forwarding, packet classification, network address translation, and packet encryption. Such routers and switches generally include multiple network processors in an array of multiple line cards and control cards with at least one network processor associated with each card. As consumers continue to demand more bandwidth to satisfy their growing multimedia needs, in order to keep up with the processing power needed to process the increase in network traffic flowing through these network elements, modern network processor architecture employs multiple processing execution cores operating in a multi-threaded environment to take advantage of performance gains through workload parallelism.
Within a multithreaded network processor, packet data is typically distributed and stored temporarily in multiple work queues until the packet data is needed for processing by one of the threads executing in one of the execution cores. Work queues are hardware implemented First-In-First-Out storage elements (FIFOs). When data is written into a work queue, this write operation is also known as a PUSH operation. When packet data is needed for processing, the source of the request, which is the execution core that is processing the particular execution thread requiring the packet data, fetches that data from the work queue. Such read request to a work queue is also known as a POP request.
During normal operation, it is possible for a read request to be issued to an empty work queue. Conditions that may result in a read request being issued to an empty work queue include network data throughput variations due to unsteady network traffic or traffic interruptions, reconfigurations of the network, or other network conditions that may cause temporary starvation of the work queues. When an empty work queue receives a read request, if the work queue is configured in a non-blocking mode, a fail value is returned to the source of the read request immediately. The source of the read request would then terminate the read request and poll for the required data at a later time. As a result, additional system resources and higher power consumption may be required to perform these subsequent read polling operations.
To avoid this read polling mechanism and the additional resources that are needed by the read polling mechanism to handle read requests to an empty work queue configured in a non-blocking mode, a work queue can be configured in a blocking mode instead. When a work queue is operating in a blocking mode, a read request to an empty work queue is not returned until data is written into the work queue to complete the read request. While this mode of operation avoids the read polling mechanism described above, if another execution thread whose task is to write to that empty work queue becomes unresponsive, then the source of the read request would wait and stall indefinitely. As the number of execution threads in a network processor increases to accommodate the increase in network traffic, the number of potentially stalled threads scales along with the number of execution threads. This can lead to thousands to millions of stalled threads and dramatically hinder the performance of a network processor resulting in dropped traffic and prolonged network interruptions.